Hybrid drive comprising write cache spanning non-volatile semiconductor memory and disk

ABSTRACT

A hybrid drive is disclosed comprising a head actuated over a disk comprising a plurality of data tracks, where each data track comprises a plurality of data sectors. The hybrid drive further comprises a non-volatile semiconductor memory (NVSM) comprising a plurality of memory segments. When a write command is received from a host including write data, the write data is written to one of a disk cache and a NVSM cache, wherein the write data is eventually flushed to a non-cache area of the disk.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims priority from provisional U.S. Patent Application Ser. No. 61/373,488, filed on Aug. 13, 2010, the specification of which is incorporated herein by reference.

BACKGROUND

Hybrid drives are conventional disk drives augmented with a non-volatile semiconductor memory (NVSM) such as a flash which helps improve certain aspects of the disk drive. For example, the non-volatile semiconductor memory may store boot data in order to expedite the boot operation of a host computer. Another use of a NVSM may be to store frequently accessed data and/or non-sequential data for which the access time is typically much shorter than the disk (which suffers from mechanical latency including seek and rotational latency). Other policies may reduce write amplification of the NVSM in order to maximize its longevity, such as storing frequently written data to the disk (or data having a write/read ratio that exceeds a predetermined threshold).

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A shows a disk drive according to an embodiment of the present invention comprising a head actuated over a disk including a disk cache, and a non-volatile semiconductor memory (NVSM) including a NVSM cache.

FIG. 1B is a flow diagram according to an embodiment of the present invention wherein when a write command is received the write data is cached in one of the disk cache and the NVSM cache before being flushed to a non-cache area of the disk.

FIG. 1C is a flow diagram according to an embodiment of the present invention wherein the write data of a write command is cached if the target PBA identifies a data sector in the non-cache area of the disk.

FIG. 2 is a flow diagram according to an embodiment of the present invention wherein a ratio of access to the disk cache and NVSM cache is used to select which cache to store write data.

FIG. 3 is a flow diagram according to an embodiment of the present invention wherein if the disk cache is selected based on the disk/NVSM ratio, but the head is away from the disk cache, then the write data is cached in the NVSM cache.

FIG. 4 is a flow diagram according to an embodiment of the present invention wherein if the NVSM cache is selected to cache write data, but the NVSM is busy servicing other commands, then the write data is cached in the disk cache.

FIG. 5 shows an embodiment of the present invention wherein the size of the NVSM cache is decreased as the life remaining of the NVSM decreases.

FIG. 6 shows an embodiment of the present invention wherein the disk/NVSM threshold is increased as the life remaining of the NVSM decreases.

FIG. 7A shows an embodiment of the present invention wherein a disk/NVSM threshold is increased as the amount of free space remaining in the NVSM cache decreases.

FIG. 7B shows an embodiment of the present invention wherein the disk/NVSM threshold is decreased as the amount of free space remaining in the disk cache decreases.

FIG. 8 is a flow diagram according to an embodiment of the present invention wherein when a read command is received, the data may be read from the NVSM cache, the disk cache, and/or the non-cache area of the disk.

DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION

FIG. 1A shows a hybrid drive according to an embodiment of the present invention comprising a head 2 actuated over a disk 4 comprising a plurality of data tracks 6, where each data track comprises a plurality of data sectors. The hybrid drive further comprises a non-volatile semiconductor memory (NVSM) 8 comprising a plurality of memory segments. Control circuitry 10 executes the flow diagram of FIG. 1B, wherein when a write command is received from a host including write data (step 12), a determination is made (step 14) whether to write the write data to one of a disk cache (step 16) and a NVSM cache (step 18). The write data is written to one of a disk cache and a NVSM cache, and during a flush operation (step 20) the write data is flushed to a non-cache area of the disk (step 22).

In the embodiment of FIG. 1A, the disk 4 comprises embedded servo sectors 24 ₀-24 _(N) that define the data tracks 6. The control circuitry 10 processes a read signal 26 emanating from the head 2 to demodulate the servo sectors 24 ₀-24 _(N) and generate a position error signal (PES) representing an error between the actual position of the head and a target position relative to a target track. The control circuitry 10 filters the PES using a suitable compensation filter to generate a control signal 28 applied to a voice coil motor (VCM) 30 which rotates an actuator arm 32 about a pivot in order to actuate the head 2 radially over the disk in a direction that reduces the PES.

Any suitable NVSM 8 may be employed in the embodiments of the present invention such as a suitable flash memory. In one embodiment, the NVSM 8 comprises a plurality of blocks, wherein each block comprises a plurality of memory segments referred to as pages, and each page may store one or more data sectors. The blocks are programmed a page at a time, and an entire block is erased in a unitary operation. In one embodiment, there is a limit to the number of times the blocks of the NVSM may be programmed and erased (referred to as endurance). When the NVSM reaches the limit of program/erase cycles it essentially reaches end of life (for subsequent write operations). Accordingly, in one embodiment of the present invention the disk cache helps extend the life of the NVSM by implementing a write cache that spans both the NVSM and the disk. In this manner, at least some of the write commands are cached in the disk cache which reduces write amplification in the NVSM.

In another embodiment of the present invention, implementing a write cache using both the disk and NVSM helps improve performance by writing data to both channels concurrently. For example, multiple write commands may be queued in a command queue (or a single large write command broken into multiple write commands) wherein a first part of the write data may be written to the disk cache while concurrently writing a second part of the write data to the NVSM cache.

Employing a write cache in a hybrid drive improves performance by avoiding the mechanical latency involved with accessing the disk (seek latency and rotational latency) when servicing non-sequential write commands. Instead of seeking the head around the disk to service non-sequential write commands, the write data is cached in one of the disk cache and the NVSM cache, and then later flushed to the non-cache area of the disk, for example, when the hybrid drive is idle or otherwise ready to flush the write cache. In one embodiment, the disk cache is implemented as a circular buffer so that non-sequential write commands can be written to sequential data sectors (thereby avoiding long seeks within the disk cache).

In the embodiment of FIG. 1A, the NVSM 8 comprises a cache area and a non-cache area. The non-cache area of the NVSM may be used to store data that helps improve performance of the hybrid drive, such as frequently accessed data and/or boot data for the host operating system. In one embodiment, the logical block addresses (LBAs) mapped to the non-cache area of the NVSM 8 may change over time depending on the historical use of the hybrid drive. In another embodiment, the entire NVSM 8 may be used as a write cache, and in yet another embodiment described below, the size of the NVSM cache may change over time, such as decreasing the size of the NVSM cache as the life remaining of the NVSM decreases.

FIG. 1C is a flow diagram according to an embodiment of the present invention that extends on the flow diagram of FIG. 1B, wherein a write command is received from a host comprising an LBA (step 34). The LBA is mapped to a physical block address (PBA) of the target data sectors (step 36), wherein if the PBA is mapped to a data sector in the non-cache area of the NVSM (step 38), the write data is written to the NVSM (step 40). If the PBA is mapped to a data sector in the non-cache area of the disk (step 38), then the write data is cached in one of the disk cache and the NVSM cache before being flushed to the non-cache area of the disk at a later time.

In one embodiment when flushing the data from the NVSM cache, the data may first be written to the disk cache in order to flush the NVSM cache quickly. The data may then be flushed from the disk cache to the non-cache area of the disk at a later time (e.g., while servicing access commands using the NVSM or while the hybrid drive is idle). In another embodiment when flushing the data from the NVSM cache, the data may be migrated to the non-cache area of the NVSM (instead of flushing the data to the disk) based on a migration policy. For example, if data stored in the NVSM cache is accessed several times by the host prior to being flushed to the disk, the migration policy may migrate the data by flushing it to the non-cache area of the NVSM instead of flushing the data to the non-cache area of the disk. In one embodiment, flushing the data from the NVSM cache to the non-cache area of the NVSM is implemented by copying the data between blocks. In an alternative embodiment, the blocks storing the cached data are simply re-assigned from the NVSM cache to the non-cache area of the NVSM.

FIG. 2 is a flow diagram according to an embodiment of the present invention wherein a disk/NVSM counter ratio is maintained at a target level in order to spread the write commands over the disk cache and the NVSM cache at a target ratio (e.g., spread the write commands evenly over the NVSM cache and the disk cache). When a write command is received from the host (step 42) a disk/NVSM counter ratio is compared to a threshold (step 44). If the ratio is less than the threshold (meaning that fewer write commands have been serviced by the disk cache), then the write data is written to the disk cache (step 46) and a disk cache counter is incremented (step 48). If the ratio is greater than the threshold (meaning that fewer write commands have been serviced by the NVSM cache), then the write data is written to the NVSM cache (step 50) and a NVSM cache counter is incremented (step 52). The counters in this embodiment may represent any suitable value, such as a number of write commands, or a total number of data sectors over the write commands.

FIG. 3 is a flow diagram according to an embodiment of the present invention that extends on the flow diagram of FIG. 2, wherein when a write command is received from the host (step 54) and the disk/NVSM counter ratio is less than the threshold (step 56) such that the disk cache is selected to cache the write data, but the head is away from the disk cache (step 58) (e.g., parked on a ramp or servicing other commands), the write data is written to the NVSM cache (thereby overriding the ratio threshold condition). Accordingly, in this embodiment the NVSM counter may increase until the head is positioned back over the disk cache wherein subsequent write commands are serviced by the disk cache until the counter ratio again reaches the target threshold. In one embodiment, the head may be considered over the disk cache at step 58 as long as the head is near the disk cache (e.g., within a threshold number of data tracks).

FIG. 4 is a flow diagram according to an embodiment of the present invention that extends on the flow diagram of FIG. 2, wherein when a write command is received from the host (step 60) and the disk/NVSM counter ratio is greater than the threshold (step 62) such that the NVSM cache is selected to cache the write data, but the NVSM is busy servicing other commands (step 64), the write data is written to the disk cache (thereby overriding the ratio threshold condition). Accordingly, in this embodiment the disk counter may increase until the NVSM is no longer busy wherein subsequent write commands are serviced by the NVSM cache until the counter ratio again reaches the target threshold.

FIG. 5 shows an embodiment of the present invention wherein as the life remaining of the NVSM decreases (due to the number of program/erase cycles increasing), the size of the NVSM cache is decreased. This embodiment helps extend the life of the NVSM since using the NVSM as a write cache increase write amplification of the NVSM. In an alternative embodiment show in FIG. 6, the threshold for the disk/NVSM counter ratio may be increased as the life remaining of the NVSM decreases so that more write data is cached in the disk cache. Both of these embodiments help reduce write amplification of the NVSM by routing more of the write data to the disk cache rather than the NVSM cache.

FIG. 7A shows an embodiment of the present invention wherein the threshold for the disk/NVSM counter threshold is increased as the amount of free space in the NVSM cache decreases. This embodiment helps prevent the NVSM cache from overflowing by routing more write data to the disk cache until the write data can be flushed from the NVSM cache. FIG. 7B shows the converse embodiment wherein the disk/NVSM counter threshold is decreased as the amount of free space in the disk cache decreases. This embodiment helps prevent the disk cache from overflowing by routing more write data to the NVSM cache until the write data can be flushed from the disk cache.

In one embodiment, the NVSM cache can be used to cache write data of new write commands while old write data stored in the disk cache is flushed to the non-cache area of the disk. Conversely, the disk cache can be used to cache write data of new commands while old write data stored in the NVSM cache is flushed to the non-cache area of the disk. In one embodiment, the write commands routed to the NVSM cache and the disk cache may be selected based on a rotational position optimization (RPO) algorithm which attempts to minimize the access time to the non-cache area of the disk by minimizing the seek and rotational latency. For example, a first group of write commands having closest proximity may be cached in the disk cache, and a second group of write commands having closest proximity may be cached in the NVSM cache. In this manner, the access latency is minimized when flushing either the disk cache or the NVSM cache to the non-cache area of the disk. In one embodiment, the disk cache and the NVSM cache may be flushed together during the same flush operation in which case the write data is read in an optimal order from both caches based on the RPO algorithm.

FIG. 8 is a flow diagram according to an embodiment of the present invention wherein when a read command is received from a host (step 66) the LBA is converted into one or more PBAs of target data sectors (step 68). For example, an LBA may identify data that is cached in one of the NVSM and the disk cache, and/or the data may have been flushed to the non-cache area of the disk. Accordingly, in one embodiment a decision is made (step 70) to determine where to read the data. For example, in one embodiment the data is read from the NVSM cache (step 72) if stored there since the NVSM typically provides the highest performance. If the data is not stored in the NVSM cache but instead stored in the disk cache, then it may be read from the disk cache (step 74). If the data is not stored in the NVSM cache or the disk cache, it may be read from the non-cache area of the disk or from the non-cache area of the NVSM (step 76).

In one embodiment, data may be stored in multiple locations. For example, data may be stored in the NVSM cache and in the non-cache area of the disk after flushing the NVSM cache and before erasing the NVSM cache. Similarly, data may be stored in the disk cache and in the non-cache area of the disk after flushing the disk cache and before overwriting the disk cache. In this manner, a decision may be made to read the data from the location that provides the best performance, and in one embodiment, the data for different read commands may be read concurrently from multiple locations (e.g., concurrently from the NVSM cache and from the disk). In one embodiment, after flushing the NVSM cache and/or the disk cache the old data remains in the cache as long as possible before erasing the block in the NVSM cache or overwriting the data in the disk cache. This embodiment improves performance by allowing the data to be read from either the write cache (NVSM or disk) and/or the non-cache area of the disk. In one embodiment, the data may be evicted from either write cache using any suitable eviction policy, such as evicting the least recently accessed data or least frequently accessed data.

Any suitable control circuitry may be employed to implement the flow diagrams in the embodiments of the present invention, such as any suitable integrated circuit or circuits. For example, the control circuitry may be implemented within a read channel integrated circuit, or in a component separate from the read channel, such as a disk controller and/or NVSM controller, or certain steps described above may be performed by a read channel and others by a disk controller and/or NVSM controller. In one embodiment, the read channel and controllers are implemented as separate integrated circuits, and in an alternative embodiment they are fabricated into a single integrated circuit or system on a chip (SOC). In addition, the control circuitry may include a suitable preamp circuit implemented as a separate integrated circuit, integrated into the read channel or disk controller circuit, or integrated into an SOC.

In one embodiment, the control circuitry comprises a microprocessor executing instructions, the instructions being operable to cause the microprocessor to perform the steps of the flow diagrams described herein. The instructions may be stored in any computer-readable medium. In one embodiment, they may be stored on a non-volatile semiconductor memory external to the microprocessor, or integrated with the microprocessor in a SOC. In another embodiment, the instructions are stored on the disk and read into a volatile semiconductor memory when the hybrid drive is powered on. In yet another embodiment, the control circuitry comprises suitable logic circuitry, such as state machine circuitry. 

What is claimed is:
 1. A hybrid drive comprising: a disk comprising a plurality of data tracks, each data track comprising a plurality of data sectors; a head actuated over the disk; a non-volatile semiconductor memory (NVSM) comprising a plurality of memory segments; and control circuitry operable to: define a disk cache comprising a plurality of the data sectors and a NVSM cache comprising a plurality of the memory segments; receive a write command from a host including write data; determine whether to write the write data to one of the disk cache and the NVSM cache in response to a disk counter and a NVSM counter; write the write data to one of the disk cache and the NVSM cache; increment the disk counter when data is written to the disk cache; increment the NVSM counter when data is written to the NVSM cache; and flush the write data to a non-cache area of the disk.
 2. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to map a logical block address (LBA) received with the write command to a physical block address (PBA) assigned to a data sector in the non-cache area of the disk.
 3. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to determine whether to write the write data to one of the disk cache and the NVSM cache in response to a ratio of the disk counter and the NVSM counter.
 4. The hybrid drive as recited in claim 3, wherein the control circuitry is further operable to write the write data to the disk cache when the ratio of the disk counter to the NVSM counter exceeds a threshold.
 5. The hybrid drive as recited in claim 4, wherein the control circuitry is further operable to adjust the threshold in response to a free space remaining in the NVSM cache.
 6. The hybrid drive as recited in claim 4, wherein the control circuitry is further operable to adjust the threshold in response to a free space remaining in the disk cache.
 7. The hybrid drive as recited in claim 4, wherein the control circuitry is further operable to adjust the threshold in response to a life remaining of the NVSM.
 8. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to write the write data to the NVSM cache when the head is away from the disk cache.
 9. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to write the write data to the disk cache when the NVSM is busy servicing other access commands.
 10. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to adjust a size of the NVSM cache in response to a life remaining of the NVSM.
 11. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to flush the write data to the non-cache area of the disk during an idle mode of the hybrid drive.
 12. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to: receive a read command from the host comprising a logical block address (LBA); read data from the NVSM cache when the LBA is mapped to a physical block address (PBA) assigned to a memory segment of the NVSM cache; when the LBA is not mapped to the NVSM cache, read data from the disk cache when the LBA is mapped to a PBA assigned to a data sector of the disk cache; and when the LBA is not mapped to the NVSM cache and the disk cache, read data from the non-cache area of the disk when the LBA is mapped to a PBA assigned to a data sector of the non-cache area of the disk.
 13. A method of operating a hybrid drive, the hybrid drive comprising a disk comprising a plurality of data tracks, each data track comprising a plurality of data sectors, a head actuated over the disk, and a non-volatile semiconductor memory (NVSM) comprising a plurality of memory segments, the method comprising: defining a disk cache comprising a plurality of the data sectors and a NVSM cache comprising a plurality of the memory segments; receiving a write command from a host including write data; determining whether to write the write data to one of the disk cache and the NVSM cache in response to a disk counter and a NVSM counter; writing the write data to one of the disk cache and the NVSM cache; incrementing a disk counter when data is written to the disk cache; incrementing an NVSM counter when data is written to the NVSM cache; and flushing the write data to a non-cache area of the disk.
 14. The method as recited in claim 13, further comprising mapping a logical block address (LBA) received with the write command to a physical block address (PBA) assigned to a data sector in the non-cache area of the disk.
 15. The method as recited in claim 13, further comprising determining whether to write the write data to one of the disk cache and the NVSM cache in response to a ratio of the disk counter and the NVSM counter.
 16. The method as recited in claim 15, further comprising writing the write data to the disk cache when the ratio of the disk counter to the NVSM counter exceeds a threshold.
 17. The method as recited in claim 16, further comprising adjusting the threshold in response to a free space remaining in the NVSM cache.
 18. The method as recited in claim 16, further comprising adjusting the threshold in response to a free space remaining in the disk cache.
 19. The method as recited in claim 16, further comprising adjusting the threshold in response to a life remaining of the NVSM.
 20. The method as recited in claim 13, further comprising writing the write data to the NVSM cache when the head is away from the disk cache.
 21. The method as recited in claim 13, further comprising writing the write data to the disk cache when the NVSM is busy servicing other access commands.
 22. The method as recited in claim 13, further comprising adjusting a size of the NVSM cache in response to a life remaining of the NVSM.
 23. The method as recited in claim 13, further comprising flushing the write data to the non-cache area of the disk during an idle mode of the hybrid drive.
 24. The method as recited in claim 13, further comprising: receiving a read command from the host comprising a logical block address (LBA); reading data from the NVSM cache when the LBA is mapped to a physical block address (PBA) assigned to a memory segment of the NVSM cache; when the LBA is not mapped to the NVSM cache, reading data from the disk cache when the LBA is mapped to a PBA assigned to a data sector of the disk cache; and when the LBA is not mapped to the NVSM cache and the disk cache, reading data from the non-cache area of the disk when the LBA is mapped to a PBA assigned to a data sector of the non-cache area of the disk. 